﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace WcfContrib.Configuration
{
    /// <summary>
    /// Represents the WcfContrib configuration section
    /// </summary>
    public class WcfContribConfigurationSection : ConfigurationSection
    {
        const string DefaultSectionName = "wcfContrib";
        
        static WcfContribConfigurationSection section;
        /// <summary>
        /// Gets the configuration section.
        /// </summary>
        /// <returns>The configuration section</returns>
        public static WcfContribConfigurationSection GetSection()
        {
            if (section == null)
            {
                section = ConfigurationManager.GetSection(DefaultSectionName) as WcfContribConfigurationSection;
                if (section == null)
                {
                    section = new WcfContribConfigurationSection();
                }
            }

            return section;
        }

        /// <summary>
        /// Gets or sets the client element.
        /// </summary>
        /// <value>The client.</value>
        [ConfigurationProperty("client")]
        public ClientConfigurationElement Client
        {
            get { return (ClientConfigurationElement)base["client"]; }
            set { base["client"] = value; }
        }

        /// <summary>
        /// Gets or sets the services element.
        /// </summary>
        /// <value>The services.</value>
        [ConfigurationProperty("services")]
        public ServicesConfigurationElement Services
        {
            get { return (ServicesConfigurationElement)base["services"]; }
            set { base["services"] = value; }
        }

        /// <summary>
        /// Gets or sets the extensions element.
        /// </summary>
        /// <value>The extensions.</value>
        [ConfigurationProperty("extensions")]
        public ExtensionsConfigurationElement Extensions
        {
            get { return (ExtensionsConfigurationElement)base["extensions"]; }
            set { base["extensions"] = value; }
        }
    }
}
